#pragma once

#include <afxsock.h>

[event_source(native)]
class CShell : public CAsyncSocket
{
public:
	CShell(void);
	~CShell(void);

	virtual void SetHostname(LPCTSTR hostname);
	virtual void SetPort(int port);

	virtual void Connect();
	virtual void Disconnect();

	virtual bool IsConnected();

	__event void OnConnectEvent(int nErrorCode);
	__event void OnDisconnectEvent();
	__event void OnDataAvailableEvent(unsigned char* dataBuffer, int dataCount);

protected:
	LPCTSTR hostname;
	int port;
	bool connected;

	void OnConnect(int nErrorCode);
};

